Modulus (x Mod y)

Basic and Crystal syntax.

Usage

x Mod y

Divides x by y and returns a remainder that is a whole number. The Number values x and y can be positive or negative, and they can be fractional. If x or y is fractional, it will be first rounded before the modulus is taken.

Examples

The following examples are applicable to both Basic and Crystal syntax:

83 Mod 10

Returns 3.

10 Mod 3

Returns 1.

-10 Mod 3

Returns -1.

10 Mod -3

Returns 1.

10 Mod 3.5

Returns 2 since 3.5 is first rounded to 4 before the modulus is taken.



Seagate Software, Inc.
http://www.seagatesoftware.com
Please send comments to:
techpubs@seagatesoftware.com